#pragma once

#include "Renderer/Buffer.h"

/*
 * VertexBuffer = 顶点缓存对象
 * 显存里每分配一段内存空间，便会在显存分配记录里，填加一条记录，有id,地址,大小
 * 这段代码就是描述显存里的id,
 * 显存里的一段空间 等于 一个OpenGLVertexBuffer对象
 *
 * */
namespace Hazel {
    class OpenGLVertexBuffer : public VertexBuffer {
    public:
        OpenGLVertexBuffer(float* vertices, uint32_t size);
        virtual ~OpenGLVertexBuffer();

        void Bind() const override;
        void Unbind() const override;

        const BufferLayout &GetLayout() const override {
            return m_Layout;
        };

        void SetLayout(const BufferLayout &layout) override {
            m_Layout = layout;
        };

    private:
        uint32_t m_RendererID;
        BufferLayout m_Layout;
    };

    class OpenGLIndexBuffer : public IndexBuffer {
    public:
        OpenGLIndexBuffer(uint32_t* indices, uint32_t count);

        virtual ~OpenGLIndexBuffer();

        void Bind() const override;

        void Unbind() const override;

        uint32_t GetCount() const override {return m_Count;}

    private:
        uint32_t m_RendererID;
        uint32_t m_Count;
    };
}
